package IO;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

class Read{
    public static void readFile(String path)throws IOException{
        FileInputStream fis=new FileInputStream(path);
        byte[] byt=new byte[1024];
        int len=0;
        while ((len=fis.read(byt))!=-1){
            System.out.println(new String(byt,0,len));

        }
        fis.close();
    }
}




public class Write {
    public static void writeFile(String path,String content)throws Exception{
        FileOutputStream fos=new FileOutputStream(path);
        byte[] buffer=content.getBytes();
        fos.write(buffer);
        fos.close();
    }
}
class TesterA{
    public static void main(String[] args) throws Exception {
    String path ="E:\\a.txt";//String
    String content ="hello java 10";
    Write.writeFile(path,content);
    Read.readFile(path);
}


}
